<%@ page language="java" import="java.util.*,model.Work,util.DateTool" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>作业查询</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/div-style.css">
    <link rel="stylesheet" type="text/css" href="css/button.css">
    <link rel="stylesheet" type="text/css" href="css/table.css">
    
  </head>
  
  <body>
    <div class="main">
    <div class="div_top">
        <div id="info">
            <!-- 右上角登录信息栏（未完成） -->
              <p id="p1">欢迎您，${username}</p><a class="ainfo" href="">修改密码</a>&nbsp;&nbsp;&nbsp;&nbsp;<a class="ainfo" href="/wdcoursemgn/logout">注销</a>
        </div>
    </div>
    <div  class="teacher_left">
          <!-- 左边菜单栏 -->
         <div id="menu">
              <!-- 修饰，无实际作用 -->
         </div>
         <div class="list">
                <ul class="list1">
                  <li> <a class="a-select" href="/wdcoursemgn/StuqueryAllWork"><font>作业查看</font></a></li>
                  <li> <a class="a-list" href="/wdcoursemgn/queryAllGrade"><font>成绩查询</font></a></li>
                  <li> <a class="a-list" href=""><font>作业展示</font></a></li>
                </ul>
         </div>
    </div>
    <div  class="div_right">
         <br/>
         <br/>
         <div id="work_list">  
                <%
                    ArrayList<Work> WorkList=new ArrayList<Work>();
                    if(request.getAttribute("WorkList")!=null)
                      WorkList= (ArrayList<Work>)request.getAttribute("WorkList");
                %>
                <p id="p4" style="margin-left:50px">已发布作业</p>
                <table id="table-1" style="margin:0 auto">
                  <tr>
                       <th>作业编号</th>
                       <th>标题</th>
                       <th>发布日期</th>
                       <th>截至提交日期</th>
                       <th>作业详情</th>
                       <th>提交状态</th>
                  </tr>
                  <%
                      for(int i=0;i<WorkList.size();i++) {
                         Work work=new Work();
                         work=WorkList.get(i);
                         String releasedate=DateTool.DatetoString(work.getReleasedate());
                         String deadline=DateTool.DatetoString(work.getDeadline());
                         String submitstate="";
                         if(work.getSubmitstate().equals("no"))
                           submitstate="未交";
                         else if(work.getSubmitstate().equals("yes"))
                           submitstate="已交";
                  %>
                  <tr>
                      <td><%=work.getWork_id()%></td>
                      <td><%=work.getTitle()%></td>
                      <td><%=releasedate%></td>
                      <td><%=deadline%></td>
                      <td><a href="/wdcoursemgn/StuquerySingleWork?work_id=<%=work.getWork_id()%>" class="alink">查看详情</a></td>
                      <td><%=submitstate%></td>
                  </tr>
                   <% 
                       }
                   %>
                </table>
                <br/>
                
         </div>
    </div>
    </div>
  </body>
</html>
